
<form role="form" class="epii" method="post" data-form="1" action="{url wait add}">
    <div class="form-group">
        <label>手机号：</label>
        <input type="text" class="form-control" name="r[phone]" value="{? $info.phone}" required
               placeholder="请输入注册手机号" id="phone">
    </div>
    <div class="form-group">
        <label>就诊人：</label>
        <select class="selectpicker" name="r[member_info_id]" id="member" data-size="5">
            <option value="">请选就诊人</option>
        </select>
    </div>
    {if $type==1}
    <div class="form-group">
        <label>房间类型：</label>
        <select class="selectpicker" name="r[ward_type]" >
            {:options,$ward_type}
        </select>
    </div>
    <div class="form-group">
        <label>tips：</label>
        <span style="color: red">普通用户去vip房间签到需要额外缴纳'{? $room_fee}元'升房费用</span>
    </div>
    {/if}
    {if $type==0}
    <div class="form-group">
        <label>医生：</label>
        <select class="selectpicker" name="r[admin_id]" >
            {:options,$doctors}
        </select>
    </div>
    {/if}
    <input type="hidden" name="type" value="{$type}">
    <div class="form-footer">
        <button type="submit" class="btn btn-primary">提交</button>
    </div>
</form>
<script>
    window.onEpiiInit(function () {
        $('#phone').change(function () {
            let phone=$(this).val();
            $('#member').empty();
            if (phone.length==11){
                var loading=layer.load(1);
                $.ajax({
                    url: '?app=wait@getMemberInfo&phone='+phone,
                    type: 'get',
                    dataType:'json',
                    success: function(res) {
                        console.log(res)
                        if(res.code==1){
                            $.each(res.data,function (index,item) {
                                if(index==0){
                                    let option1 = $('<option></option>');
                                    option1.val('');
                                    option1.text('请选择患者');
                                    $('#member').append(option1);
                                }
                                let option1 = $('<option></option>');
                                option1.val(item.id);
                                option1.text(item.name);
                                $('#member').append(option1);
                            })
                            $('#member').selectpicker('refresh');
                        }else{
                            layer.alert(res['msg'],{icon:2})
                        }
                        layer.close(loading)
                    }
                });
                // layer.close(loading)
            }
        });

    });
</script>